package se.webbzon.boltzmann.game.character;

import java.util.HashMap;
import java.util.Map;

import se.webbzon.oschi01.friendly.Friendly;
import se.webbzon.oschi01.resourceset.ResourceSet;
import se.webbzon.oschi01.textureset.Texture3D;

/** A friendly class extending AbstractCharacterTextureSet with implemented functions. **/
@Friendly class LoadedCharacterTextureSet extends AbstractCharacterTextureSet {
	
	// A map containing all character actions
	private Map<CharacterActionEnum,AbstractCharacterAction> actions;
		
	/*============================================================
	Constructors
	============================================================*/
	
	@Friendly LoadedCharacterTextureSet() {
		actions = new HashMap<CharacterActionEnum,AbstractCharacterAction>();
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Adds a new action to the character texture set. **/
	public void addAction(CharacterActionEnum actionEnum, AbstractCharacterAction action) {
		actions.put(actionEnum,action);
	}

	@Override public ResourceSet<Texture3D> getLeftUp(CharacterActionEnum action) {
		return actions.get(action).getLeftUp();
	}

	@Override public ResourceSet<Texture3D> getLeftDown(CharacterActionEnum action) {
		return actions.get(action).getLeftDown();
	}

	@Override public ResourceSet<Texture3D> getRightUp(CharacterActionEnum action) {
		return actions.get(action).getRightUp();
	}

	@Override public ResourceSet<Texture3D> getRightDown(CharacterActionEnum action) {
		return actions.get(action).getRightDown();
	}

	@Override public double getTextureSpeed(CharacterActionEnum action) {
		return actions.get(action).getTextureSpeed();
	}

	@Override public boolean hasAction(CharacterActionEnum action) {
		return actions.containsKey(action);
	}
	
}
